package com.zmn.plat.services.impl.orderconfig.distribute;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.zmn.common.dto.VtDTO;
import com.zmn.plat.model.entity.orderconfig.distribute.DistributeWeightCompany;
import com.zmn.plat.model.entity.orderconfig.distribute.DistributeWeightCompanyQuery;
import com.zmn.plat.model.entity.orderconfig.distribute.DistributeWeightStatusQuery;
import com.zmn.plat.persistence.interfaces.orderconfig.distribute.DistributeWeightCompanyDao;
import com.zmn.plat.services.interfaces.orderconfig.distribute.DistributeWeightCompanyService;

/**
 * 类描述：派单参数服务商配置业务处理实现
 *
 * @author mujunlin
 * @version v1.0
 * @since 2019/10/17 16:13
 */
@Service
public class DistributeWeightCompanyServiceImpl implements DistributeWeightCompanyService {

    @Resource
    private DistributeWeightCompanyDao distributeWeightCompanyDao;

    @Override
    public DistributeWeightCompany findByKey(Integer weightId) {
        return distributeWeightCompanyDao.findByKey(weightId);
    }

    @Override
    public List<DistributeWeightCompany> listPageByQuery(DistributeWeightCompanyQuery query) {
        Integer count = this.countByQuery(query);
        query.setTotalCount(count);
        return count == 0 ? new ArrayList<>(0) : distributeWeightCompanyDao.listPageByQuery(query);
    }

    @Override
    public List<VtDTO> listCityByCompanyId(Integer companyId, Integer bizType) {
        return distributeWeightCompanyDao.listCityByCompanyId(companyId, bizType);
    }

    @Override
    public Integer countByQuery(DistributeWeightCompanyQuery query) {
        return distributeWeightCompanyDao.countByQuery(query);
    }

    @Override
    public Integer updateByKey(DistributeWeightCompany distributeWeightCompany) {
        return distributeWeightCompanyDao.updateByKey(distributeWeightCompany);
    }

    @Override
    public Integer updateStatusByQuery(DistributeWeightStatusQuery query) {
        return distributeWeightCompanyDao.updateStatusByQuery(query);
    }

    @Override
    public Integer insert(DistributeWeightCompany distributeWeightCompany) {
        return distributeWeightCompanyDao.insert(distributeWeightCompany);
    }

    @Override
    public Integer deleteByKey(Integer weightId) {
        return distributeWeightCompanyDao.deleteByKey(weightId);
    }
}
